use crate::{AppState, BestDataHttpResponce};
use actix_web::{web, Responder};
use mongodb::bson::Document;
use std::collections::HashMap;

pub struct FifoService {}

impl FifoService {
    pub async fn get_fiof_info(
        query: web::Query<HashMap<String, String>>,
        app_state: web::Data<AppState>,
    ) -> impl Responder {
        println!("{:#?}", query);
        let res = app_state.seq.fiof_dao.get_fiof_info().await;
        if let Some(data) = res {
            BestDataHttpResponce {
                code: 200,
                message: "success",
                data: data,
            }
        } else {
            BestDataHttpResponce {
                code: 200,
                message: "success",
                data: Document::new(),
            }
        }
    }
}
